package com.health.system.javacommon.util;
 

public class StringUtil
{
  public static String replaceNull(String value)
  {
    String tempValue = "";
    if ((value != null) && (!(value.equals(""))) && (!(value.equals("null"))))
      tempValue = value;

    return tempValue;
  }

  public static boolean isIOS88591(String endcoding)
  {
    endcoding = endcoding.toLowerCase();
    return ((endcoding.startsWith("iso")) && (endcoding.indexOf("8859") != -1) && (endcoding.endsWith("1")));
  }

  public static boolean isUTF8(String endcoding)
  {
    endcoding = endcoding.toLowerCase();
    return ((endcoding.startsWith("UTF")) && (endcoding.indexOf("8") != -1));
  }

  public static String iso8859ToGBK(String value)
  {
    String retValue = "";
    if (value != null)
      try {
        retValue = new String(value.getBytes("iso-8859-1"), "GBK");
      }
      catch (Exception ex) {
        ex.printStackTrace();
      }

    return retValue;
  }
}